<!-- <title>瑞众银保“五个一”功成--客户经理辅导记录<title> -->
<style lang="less" scoped>
@import '@css/list.less';
</style>

<template>
  <div id="app">
    <van-sticky>
      <div class="title">辅导记录</div>
    </van-sticky>
    <div
      style="margin: 20px auto; text-align: center"
      v-if="recentThreeDaysRecordsList.length == 0"
    >
      暂无数据
    </div>
    <van-collapse
      v-model="activeNames"
      accordion
      v-for="(item, index) of recentThreeDaysRecordsList"
      :key="index"
    >
      <van-collapse-item :title="`对象：${item.target}`" :label="item.createDate" :name="index">
        <van-cell-group inset>
          <van-field
            readonly
            rows="3"
            class="fbox"
            v-model="item.target"
            label="辅导对象"
          ></van-field>
          <van-field
            readonly
            type="textarea"
            class="fbox"
            v-model="item.way"
            label="辅导形式"
          ></van-field>
          <van-field
            readonly
            type="textarea"
            class="fbox"
            v-model="item.evaluation"
            label="辅导评估"
          ></van-field>
          <van-field label="图片">
            <template #input>
              <van-uploader
                :deletable="false"
                v-model="item.uploaderImgList"
                :max-count="1"
              ></van-uploader>
            </template>
          </van-field>
        </van-cell-group>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>
<script setup>
import {
  onBeforeMount,
  onMounted,
  onUnmounted,
  watch,
  computed,
  provide,
  inject,
  ref,
  reactive,
  nextTick,
  h
} from 'vue'
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
const dayjs = inject('$dayjs')
const showPageLoading = inject('showPageLoading')
const hidePageLoading = inject('hidePageLoading')
const showAllNonBaseMenuItem = inject('showAllNonBaseMenuItem')
const hideAllNonBaseMenuItem = inject('hideAllNonBaseMenuItem')
import { isIOS, parseTime, handleFontSize } from '@/utils'
import { yb51_daily_tutoring_racord_getListByWeeksAndAgentCode } from '@/request/api.js'

onMounted(() => {
  agentcode = route.query.agentcode
  weeks = route.query.weeks
  getrecentThreeDaysRecords()
})

let agentcode
let weeks

const activeNames = ref(['1'])

//获取经理最近三天拜访记录列表
const recentThreeDaysRecordsList = ref([])
function getrecentThreeDaysRecords() {
  showPageLoading()
  let params = new FormData()
  params.append('agentCode', agentcode)
  params.append('week', weeks)

  yb51_daily_tutoring_racord_getListByWeeksAndAgentCode(params).then((r) => {
    hidePageLoading()
    if (r.status == 200) {
      recentThreeDaysRecordsList.value = r.data.map((item) => {
        item['uploaderImgList'] = [{ url: item.fileUrl }]
        return item
      })
     
    } else {
      console.log('出错了，请重试')
      alert('出错了，请重试')
    }
  })
}
</script>
